<?php

require_once('session.php');
require_once('../inc/conn.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/table.css" rel="stylesheet" type="text/css" />
</head>
<body>

<form name="form_add" id="form_add" action="admin_add_pass.php" method="post">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td class="tt"colspan="2">管理员列表</td>
</tr>
<tr>
<td height="35">账号</td>
<td width="258">操作</td>
</tr>

<?php
$total_num=mysql_num_rows(mysql_query("SELECT id FROM admin"));

$pagesize=10;

$page_num=ceil($total_num/$pagesize);

$page=isset($_GET['page'])?$_GET['page']:1;
if($page<1 || $page==''){
$page=1;
}
if($page>$page_num){
$page= $page_num;
}

$offset=$pagesize * ($page-1) ;

$prepage= ($page<>1) ?$page-1:$page;
$nextpage=($page<>$page_num)?$page+1:$page;

$sql="SELECT * FROM admin LIMIT $offset,$pagesize";
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){
 ?>
<tr>

<td height="35"><?=$row['admin_name']?> </td>
<td><input type="button"name="button"id="button"value="修改" onclick="window.location.href='admin_modify.php?id=<?=$row['id']?>'" />&nbsp; &nbsp;
<input type="button"name="button2"id="button2"value="删除" onclick="window.location.href='admin_delete.php?id=<?=$row['id']?>'"<?php
 if($row['admin_name']=='admin'){echo"disabled='disabled'";}?>/>
</td>
</tr>
<?php
}
?>
<tr>
<td height="35" colspan="2" align="center"><?=$page?>/<?=$page_num?>&nbsp;&nbsp;<a href="?page=1">首页</a>&nbsp;&nbsp;
<a href="?page=<?=$prepage?>">上一页</a>&nbsp;&nbsp;<a href="?page=<?=$nextpage?>">下一页</a>&nbsp;&nbsp;<a href="?page=<?=$page_num?>">尾页</a></td>
</tr>
</table>
</form>
</body>
</html>